package com.greentreecs.fms.pojo.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 刀氏春秋
 * @date 2023/12/4
 */
@Data
public abstract class AccountingRecDO {
    @ApiModelProperty("房号")
    @ExcelProperty("房号")
    private String roomNo;
    @ApiModelProperty("账号")
    @ExcelProperty("账号")
    private String accountNo;
    @ApiModelProperty("姓名")
    @ExcelProperty("姓名")
    private String guestName;
    @ApiModelProperty("单据号")
    @ExcelProperty("单据号")
    private String docNo;
    @ApiModelProperty("科目")
    @ExcelProperty("科目")
    private String type;
    @ApiModelProperty("金额")
    @ExcelProperty("消费金额")
    private String bill;
    @ApiModelProperty("入账时间")
    @ExcelProperty("入账时间")
    private String time;
    @ApiModelProperty("操作员")
    @ExcelProperty("操作员")
    private String operator;

    /**
     * 检查当前记录对象同其他记录对象是否相同
     * 检查逻辑是姓名、账号、房号相同
     *
     * @param other 其他记录对象
     * @return 当前记录对象同其他记录对象是否相同
     */
    public boolean isMatchWith(AccountingRecDO other) {
        boolean isNameSame = true;
        if (this.guestName != null && other.guestName != null) {
            isNameSame = this.guestName.equals(other.guestName);
        }
        boolean isAccountSame = true;
        if (this.accountNo != null && other.accountNo != null) {
            isAccountSame = this.accountNo.equals(other.accountNo);
        }
        boolean isRoomNoSame = true;
        if (this.roomNo != null && other.roomNo != null) {
            isRoomNoSame = this.roomNo.equals(other.roomNo);
        }
        return isNameSame && isAccountSame && isRoomNoSame;
    }
}
